package com.atguigu.tingshu.order.interceptor.impl;

import java.math.BigDecimal;

import com.atguigu.tingshu.common.constant.KafkaConstant;
import com.atguigu.tingshu.common.constant.RedisConstant;
import com.atguigu.tingshu.common.constant.SystemConstant;
import com.atguigu.tingshu.common.util.AuthContextHolder;
import com.atguigu.tingshu.model.order.OrderDerate;
import com.atguigu.tingshu.model.order.OrderDetail;
import com.atguigu.tingshu.order.context.SaveOrderStrategyContext;
import com.atguigu.tingshu.order.strategy.SaveOrderStrategy;
import com.atguigu.tingshu.vo.order.OrderDerateVo;
import com.atguigu.tingshu.vo.order.OrderDetailVo;
import com.google.common.collect.Lists;

import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import com.google.common.collect.Maps;

import com.atguigu.tingshu.model.order.OrderInfo;
import com.atguigu.tingshu.order.interceptor.OrderHandlerInterceptor;
import com.atguigu.tingshu.order.service.OrderDerateService;
import com.atguigu.tingshu.order.service.OrderDetailService;
import com.atguigu.tingshu.order.service.OrderInfoService;
import com.atguigu.tingshu.vo.order.OrderInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.redisson.RedissonBlockingDeque;
import org.redisson.api.RBlockingDeque;
import org.redisson.api.RDelayedQueue;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

/**
 * Author  王东剑
 * Created on 23/6/2024 PM12:27
 * Package_name com.atguigu.tingshu.order.interceptor.impl
 * Description
 */
@Service
@Slf4j
public class SavaOrderOrderHandlerInterceptor implements OrderHandlerInterceptor {
	@Autowired
	private OrderInfoService orderInfoService;
	@Autowired
	private OrderDetailService orderDetailService;
	@Autowired
	private OrderDerateService orderDerateService;
	@Autowired
	private RedissonClient redissonClient;

	@Override
	public OrderInfoVo submitOrderRequestProcess(OrderInfoVo orderInfoVo) {
		log.info("SavaOrderOrderHandlerInterceptor.submitOrderRequestProcess");
		SaveOrderStrategy saveOrderStrategy = SaveOrderStrategyContext.getSaveOrderStrategy(orderInfoVo.getPayWay());
		return saveOrderStrategy.saveOrder(orderInfoVo);
	}



	@Override
	public int sort() {
		return 3;
	}
}
